<?php
session_start();
function __autoload($className)
	{
    	require_once('../class/' . $className . '.class.php');
	}
require_once '../header.php';
$webroot="../";
require_once '../html/sellerTemplate.php';
?>
<script type="text/javascript" src="../html/jquery.js" >
</script>
<script type="text/javascript" >
function insertPaypal()
{
	$.ajax({
		url: "paypalDo.php" ,
		type:'POST',
		data:"do=insert",
		cache: false,
		success: function(j){
			$("#insert").html(j);
	  	}
	});	
}
function deletePaypal(paypalEmail)
{
	$.ajax({
		url: "paypalDo.php" ,
		type:'POST',
		data:"do=delete&paypalEmail="+paypalEmail,
		cache: false,
		success: function(j){
			location.reload();
	  	}
	});	
}
function enterPrice(paypalEmail)
{
	
	var price=document.getElementById(paypalEmail).value;
	$.ajax({
		url: "paypalDo.php" ,
		type:'POST',
		data:"do=enterPrice&paypalEmail="+paypalEmail+"&price="+price,
		cache: false,
		success: function(j){
			location.reload();
	  	}
	});	
}
</script>
<?php
$arrInsert=$_SESSION["paypal2add"];
if(empty($arrInsert))
{
	echo "erro";
}
else 
{
	?>
	<table width="100%" border="1" id="insert">
<tr class=classmenu>
<td colspan=15>
Add Paypal For Partner
</td>
</tr>
<tr class=classtopmenu>
<td>
Paypal Email
</td>
<td>
Paypal Password
</td>
<td>
Balance
</td>
<td>
Verify
</td>
<td>
Mail Pass
</td>
<td>
Bank
</td>
<td>
Card
</td>
<td>
Address
</td>
<td>
Status
</td>
<td>
Country
</td>
<td>
Price
</td>
<td>
Delete
</td>
</tr>
<?php 
foreach($arrInsert as $showPaypal)
{
	$paypalEmail=$showPaypal['paypal_email'];
	$agent_price=$showPaypal['agent_price'];
	if($agent_price<10)
	{
		$sell_price=$agent_price*2; 
	}
	else 
	{
		$sell_price=ceil($agent_price*1.5);
	}
	$_SESSION["paypal2add"][$paypalEmail]['sell_price']=$sell_price;
	?>
	<tr>
	<td>
<?php echo $showPaypal['paypal_email'];?>
</td>
<td>
<?php echo $showPaypal['paypal_password'];?>
</td>
<td>
<?php echo $showPaypal['balance'];?>
</td>
<td>
<?php echo $showPaypal['is_verify'];?>
</td>
<td>
<?php echo $showPaypal['have_pass_mail'];?>
</td>
<td>
<?php echo $showPaypal['bank_info'];?>
</td>
<td>
<?php echo $showPaypal['card_info'];?>
</td>
<td>
<?php echo $showPaypal['address'];?>
</td>
<td>
<?php echo $showPaypal['status'];?>
</td>
<td>
<?php echo $showPaypal['country'];?>
</td>
<td >
<input id="<?php echo $paypalEmail;?>"  name="price"  type="text" size="3" onmouseout="javascript:enterPrice('<?php echo $paypalEmail;?>');" value="<?php echo $showPaypal['agent_price'];?>" />
</td>
<td>
<a href="javascript:deletePaypal('<?php echo $paypalEmail;?>');" >Delete</a>
</td>
	</tr>
	<?php
}
?>
<tr class=classmenu>
<td colspan=15>
<input name="submit" type="submit" value="Confirm" onclick="javascript:insertPaypal();" />
</td>
</tr>
</table>
	<?php
	
}
?>